
#include <stdio.h>
#include <assert.h>
#include <string.h>

#include "parser.h"



const char *CHttpParser::searchToken( const char *token, int tokenLen, int *valLen )
{
	char *start, *end;

	if( NULL == m_content ) {
		fprintf(stderr, "CHttpParser::searchToken, m_content is NULL\n");
		return 0;
	}

	start = strstr(m_content, token);
	if( NULL == start )
		return NULL;

	start += tokenLen + 2;
	end = strstr(start, "\r\n");
	
	*valLen = (int)(end - start);

	return start;
}

TOKEN_NAME CHttpParser::parseTokenLine( char *startLinePtr, int LineLen, char **valuePtr )
{

	for( int i=0; i<LineLen; i++ ) {
		if( startLinePtr[i] = ':' ) {
			*valuePtr = (startLinePtr + i + 2);
			break;
		}
	}

	return TN_NONE;

}
